package com.zhuang.facade;

/**
 * @Classname SmartAppliancesFacade
 * @Description 智能音箱类  外观类
 * @Date 2021/3/24 19:24
 * @Created by dell
 */

public class SmartAppliancesFacade {
    private Light light;
    private TV tv;
    private AirCondition airCondition;

    public SmartAppliancesFacade() {
        light = new Light();
        tv = new TV();
        airCondition = new AirCondition();
    }

    //私有打开方法 外界访问不了
    //一键打开
    private void on() {
        light.on();
        tv.on();
        airCondition.on();
    }

    //私有关闭方法 外界访问不了
    //一键关闭
    private void off() {
        light.off();
        tv.off();
        airCondition.off();
    }

    //判断方法
    public void say(String message) {
        if (message.contains("打开")) {
            on();
        } else if (message.contains("关闭")) {
            off();
        } else {
            System.out.println("你说的指令我听不懂！！！");
        }

    }
}
